package com.eshop.base.controller;

import com.eshop.base.protocol.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    // 捕获所有其他异常
    @ExceptionHandler(Exception.class)
    public Result<String> handleGenericException(Exception ex) {
        log.info(ex.getMessage());
        return Result.failure("系统异常，请稍后重试");
    }
}
